
<html>
<head>
  <title>Mail</title>
	 <link type="text/css" rel="stylesheet" href="/stylesheets/main.css" />
</head>
<body>

{% if user %}
  <span style="color:red;margin-right:8px;">logged in:</span> {{ user }}
  {%if sign_out%} | <a href="{{sign_out}}">Sign out</a>{%endif%}
{% endif %}

<h1>Simple Inexpensive Email Alerter</h1>
<form action="/mail" method="post">
<table class="sample">
	<tr class="d0">
	    <th>Send an email to list</th>
        </tr>

  <tr><td>Campaign Name</td><td> <input name="campaign" value="{{save_user.campaign}}"/></td></tr>
  <tr><td>Subject</td><td> <input name="subject" value="{{save_user.subject}}"/></td></tr>
  <tr><td>Letter Link (e.g., http://server.com/letter.html)</td><td> <input name="bodyurl" value="{{save_user.body_link}}"/></td></tr>
  <tr><td>To Link (e.g, http://server.com/to_letter.txt)</td><td> <input name="tourl" value="{{save_user.to_link}}"></td></tr>
  <tr><td>Sender Email Address</td><td> <input name="from" value="{{save_user.from_email}}"></td></tr>
  <tr><td><input type="submit" name="" value="Send"></td></tr>

</table>
</form>

<table class="sample">
	<tr class="d0">
	    <th>Latest Emails Sent</th>
        </tr>
	<tr>
	    <th>Email</th>
	    <th>Sent</th>
	    <th>Modified</th>
	    <th>Created</th>
	</tr>

{%for aitem in items%}
<tr class="{% cycle d0,d1 %}">

<td>	{{aitem.email|escape}} </td>
<td>	{{aitem.sent|escape}} </td>
<td>	{{aitem.modified|escape}} </td>
<td>	{{aitem.created|escape}} </td>
</tr>

{%endfor%}
</table>

<br/>

<table class="sample">
	<tr class="d0">
	    <th>Emails to be sent</th>
        </tr>
	<tr>
	    <th>Email</th>
	    <th>Sent</th>
	    <th>Modified</th>
	    <th>Created</th>
	</tr>

{%for aitem in itemstosend%}
<tr class="{% cycle d0,d1 %}">

<td>	{{aitem.email|escape}} </td>
<td>	{{aitem.sent|escape}} </td>
<td>	{{aitem.modified|escape}} </td>
<td>	{{aitem.created|escape}} </td>
</tr>

{%endfor%}
</table>

<br/>

<table class="sample">
	<tr class="d0">
	    <th>History of Campaigns</th>
        </tr>
	<tr>
	    <th>Campaign</th>
	    <th>Email</th>
	    <th>Owner</th>
	    <th>Sent</th>
	    <th>Modified</th>
	    <th>Created</th>
	</tr>

{%for aitem in itemssent%}
<tr class="{% cycle d0,d1 %}">

<td>	{{aitem.campaign|escape}} </td>
<td>	{{aitem.email|escape}} </td>
<td>	{{aitem.owner|escape}} </td>
<td>	{{aitem.sent|escape}} </td>
<td>	{{aitem.modified|escape}} </td>
<td>	{{aitem.created|escape}} </td>
</tr>

{%endfor%}
</table>

</body>
</html>